package com.moneywelcome.orderassembly.apiImpl;

import com.moneywelcome.annnotation.RedisAnnotation;
import com.moneywelcome.orderassembly.service.DividendRecordService;
import com.moneywelcome.orderassembly.service.InvestRecordService;
import com.moneywelcome.orderassembly.service.ProfitDayService;
import com.moneywelcome.orderassembly.service.RedeemRecordService;
import com.moneywelcome.orderfacade.OrderCreatApi;
import com.moneywelcome.orderfacade.OrderQueryApi;
import com.moneywelcome.orderfacade.dto.DividendOrderDto;
import com.moneywelcome.orderfacade.dto.ProfitDayDto;
import com.moneywelcome.orderfacade.dto.RedeemOrderDto;
import com.moneywelcome.orderfacade.dto.SubscribeOrderDto;
import com.moneywelcome.orderfacade.vo.DividendRecordVo;
import com.moneywelcome.orderfacade.vo.InvestRecordVo;
import com.moneywelcome.orderfacade.vo.OrderPageVo;
import com.moneywelcome.orderfacade.vo.RedeemRecordVo;
import com.moneywelcome.results.PageResult;
import com.moneywelcome.results.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api(tags = "记录查询服务")
public class OrderQueryApiImpl implements OrderQueryApi {
    @Autowired
    private InvestRecordService irs;
    @Autowired
    private RedeemRecordService rrs;
    @Autowired
    private DividendRecordService drs;
    @Autowired
    private ProfitDayService pds;
    @ApiOperation("查询申购记录")
    @Override
    @RedisAnnotation
    public Result<PageResult<SubscribeOrderDto>> subscribeRecord(OrderPageVo orderPageVo) {
        return Result.success(irs.queryRecord(orderPageVo));
    }
    @RedisAnnotation()
    @ApiOperation("查询赎回记录")
    @Override
    public Result<PageResult<RedeemOrderDto>> redeemRecord(OrderPageVo orderPageVo) {
        return Result.success(rrs.queryRecord(orderPageVo));
    }
    @RedisAnnotation
    @ApiOperation("查询分红记录")
    @Override
    public Result<PageResult<DividendOrderDto>> dividendRecord(OrderPageVo orderPageVo) {
        return Result.success(drs.queryRecord(orderPageVo));
    }
    @RedisAnnotation
    @ApiOperation("查询收益记录")
    @Override
    public Result<PageResult<ProfitDayDto>> prrofitRecord(OrderPageVo orderPageVo) {
        PageResult<ProfitDayDto> dto=  pds.queryRecord(orderPageVo);
        return Result.success(dto);
    }
}
